<include file="../Public/_header" />
<php>if (!$is_support) {</php>
    <h3 style="color:red;">注意: 自动升级程序仅适用于ThinkSNS 2.1 Final Build 10920 / 10992, 而您的站点的版本为: {$system_version}</h3>
<php>}else {</php>
    <div id="container" class="so_main">
        <div class="page_tit">欢迎使用{$ts['site']['site_name']}</div>
        <div class="Toolbar_inbox">&nbsp;</div>
        <div class="list">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
             <th class="line_l" style="width:40px;">应用名</th>
             <th class="line_l" style="width:80px;">当前版本</th>
             <th class="line_l" style="width:65px;">当前版本号</th>
             <th class="line_l" style="width:65px;">是否有更新</th>
             <th class="line_l" style="width:80px;">最新版本</th>
             <th class="line_l" style="width:65px;">最新版本号</th>
             <th class="line_l" style="width:80px;">下载地址</th>
             <th class="line_l">ChangeLog</th>
             <th class="line_l" style="width:30px;">操作</th>
            </tr>
        <php>foreach ($current_version as $app => $version) {</php>
          <tr overstyle='on'>
            <td>{$app}</td>
            <td><php>echo $app == 'core' ? $system_version : '&nbsp;'</php></td>
            <td>{$version}</td>
            <php>
            $error = '';
            if ($lastest_version['error'])
                $error = $lastest_version['error_message'];
            else if ($lastest_version[$app]['error'])
                $error = $lastest_version[$app]['error_message'];
            </php>
            <php>if (!$error) {</php>
              <td><php>echo $lastest_version[$app]['has_update'] ? '<span style="color:red;">有更新</span>' : '无更新';</php></td>
              <td>{$lastest_version[$app]['lastest_version']}</td>
              <td>{$lastest_version[$app]['lastest_version_number']}</td>
              <td>
              <php>if ($lastest_version[$app]['has_update']) {</php>
                <a href="{$lastest_version[$app]['download_url']}" target="_blank">http://www.thinksns.com</a>
              <php>} else { echo ''; }</php>
              </td>
              <td><pre>{$lastest_version[$app]['changelog']}</pre></td>
              <td>
              <php>
              // 检查升级用SQL文件, 以确定"下载"还是"升级"
              $temp_version = $lastest_version[$app]['lastest_version_number'];
              if ($app == 'core')
                  $path = SITE_PATH . '/update/core_' . $temp_version . '.sql';
              else
                  $path = SITE_PATH . '/apps/' . $app . '/Appinfo/' . $app . '_' . $temp_version . '.sql';
              </php>
              <php>if ($lastest_version[$app]['has_update'] && is_file($path)) {</php>
                <a href="{:U('admin/Home/doUpdate', array('app_name'=>$app))}" onclick="return confirm('升级前请备份数据库, 确认升级?');">升级</a>
              <php>}else if ($lastest_version[$app]['has_update']) {</php>
                <a href="{$lastest_version[$app]['download_url']}" target="_blank">下载</a>
              <php>}else { echo ''; }</php>
              </td>
            <php>}else {</php>
              <td>错误: <span style="color:red;">{$error}</span></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
            <php>}</php>
          </tr>
        <php>}</php>
        </table>
        </div>
        <div class="Toolbar_inbox">&nbsp;</div>
    </div>
    <script>
    //鼠标移动表格效果
    $(document).ready(function(){
        $("tr[overstyle='on']").hover(
          function () {
            $(this).addClass("bg_hover");
          },
          function () {
            $(this).removeClass("bg_hover");
          }
        );
    });
    </script>
<php>}</php>
<include file="../Public/_footer" />